home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 9557 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.6 KB  |  48 lines

  1. Path: cs.tu-berlin.de!news
  2. From: Roman Lechtchinsky <wolfro@cs.tu-berlin.de>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: borland c 4.5
  5. Date: 2 Mar 1996 18:26:23 GMT
  6. Organization: Technical University of Berlin, Germany
  7. Message-ID: <4ha3sf$iou@news.cs.tu-berlin.de>
  8. NNTP-Posting-Host: 130.149.17.226
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=iso-8859-1
  11. Content-Transfer-Encoding: 8bit
  12.  
  13. mleusch@rzdspc1.informatik.uni-hamburg.de (Michael Leuschner) writes:
  14. > We have a problem concerning Borland C++ 4.5 and hope somebody will be able to
  15. > help us...
  16. > We developed a program in C++ with the IDE enviroment and the App Expert and
  17. > have no problem with that. Now we want to add some C source code but were
  18. > not successful. It seems that the c++ compiler is able to compile our
  19. > ANSI c sources but later the linker can't manage to link the mix of
  20. > c++ and c together...
  21. > Does anyone have a clue?
  22. > Is the a known problem (and how can you solve it) ?
  23.  
  24. I assume that the files with your C source have the .c extension and that
  25. you use include files to make you function prototypes availble in C++
  26. modules. The linking information the compiler generates for C++ functions
  27. is different from that for C functions. You have two possibilities:
  28.  
  29. a) Rename all of your .C-files to .CPP. The function names will be treated
  30. C++-like then.
  31. b) Declare all functions that are implemented in your .C files as follows:
  32.  
  33. extern "C" {
  34.  
  35. // function declarations
  36.  
  37. }
  38.  
  39. This will tell the compiler that these functions are exported from a C 
  40. module and they will be linked appropriately.
  41.  
  42. Bye
  43.  
  44. Roman
  45.